package com.jingdianjichi.oss.config;


import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: minio配置管理
 * @return: 
 * @Author:  sky
 * @date:  2024/11/9 16:38
 */
@Configuration
public class MinioConfig {

    // 注解@Value：注入yml配置文件中定义的属性值
    // url
    @Value("${minio.url}")
    private String url;

    // 账户
    @Value("${minio.accessKey}")
    private String accessKey;

    // 密码
    @Value("${minio.secretKey}")
    private String secretKey;


    // 构造MinioClient的Bean对象
    @Bean
    public MinioClient getMinoClient(){
        return MinioClient.builder().endpoint(url).credentials(accessKey,secretKey).build();
    }

}
